Setting Up a Project Manually


Table of Contents

Overview

Creating a Project for a Portal Application

Adding JAR Files to the Project

Specifying Portal Components Required at Runtime

For Extensions Only: Creating a Portal Service

Creating a Service and Implementing a Bootstrap Class

Entering the Service in the Deployment Descriptor

Deployment



Overview

If you want to develop a Knowledge Management and Collaboration (KMC) component in the Developer Studio, two approaches are possible. You can:

If no wizard is available for the task you have in mind, follow the instructions given here to set up and deploy the application manually. A number of steps are necessary. You need to:

  1. Create a project for the new portal application.
  2. Add the JAR files that are required for the application to the Java build path in Eclipse.
  3. Create and compile source code files and store them in the appropriate directories of the project.
  4. Define the deployment descriptor for the portal application. This is an XML file that specifies the portal components and services that the application accesses at runtime.
  5. For KMC extensions only: Create a portal service that ensures that the new application is registered with the portal at runtime and is started up with the portal.
  6. Package the application in a PAR file and deploy it to the remote portal using the PAR Export plugin.

The sections that follow describe these steps in detail.



Creating a Project for a Portal Application

As KMC components run on the portal platform, they must be constructed like portal applications to ensure that they can be executed in the portal. To create a KMC component that has the fundamental structure required for a portal application, you use the New Portal Application plugin in the Developer Studio. The plugin automatically creates a project that contains the directories, files and other resources that make up a portal application. To create a project for an application, proceed as follows in the Developer Studio:

Choose File -> New Project -> New Portal Application. Select Portal Application and Create a Portal Application project.
The wizard automatically creates the directories and files that are required for the portal application. Note the following:



Adding JAR Files to the Project

When you write the code for your KMC component, you use or implement various interfaces. The packages of these interfaces are bundled in JAR files, which you must specify in the build path of the application. You can find out which JAR files you need to specify with the help of the Javadocs. If you have used a particular interface or class, the interfaces or classes Javadoc shows you under the title in which JAR file the package is included. For example, it states [contained in: com.sap.netweaver.bc.rf.par - bc.rf.common_api.jar]

To reference JAR files for your application in the Developer Studio:

  1. Choose Project Properties.
  2. Select Java Build Path and choose Add Jars.



Specifying Portal Components Required at Runtime

When you run your new KMC component in the portal, it needs to access various portal applications. You use the deployment descriptor in your project to inform the portal runtime (PRT) of the applications that must be accessible at runtime. The deployment descriptor is an XML file named portalapp.xml that is located in the project under dist\WEB-INF

To specify portal components required at runtime proceed as follows:

For information on other elements in the deployment descriptor file, see the Portal Platform documentation for developers.

Entries for Deployment Descriptor

<?xml version="1.0" encoding="utf-8"?>
<application name="com.sap.ides.kmc.samples" alias="com.sap.ides.kmc.samples">
<application-config>
<property name="SharingReference" value="com.sap.portal.runtime.config,
com.sap.portal.runtime.config.component, usermanagement,
 knowledgemanagement
  com.sap.portal.ivs.connectorservice"/>

</application-config>
<components/>
<services/>
</application>



For Extensions Only: Creating a Portal Service

Extensions must be registered with the KMC configuration framework to ensure that the component runtime loads them dynamically. To achieve this, you need to add a portal service to your application project. The purpose of the service is to ensure that the extension's class loader is registered with the repository framework at startup. This ensures that at runtime all components which are required for the execution of the extension will be available for the KMC component runtime (CRT). The CRTs class loader loads the classes dynamically using Java reflection mechanisms.

To implement the portal service, you:

Creating a Service and Implementing a Bootstrap Class

You create a portal service with a plugin in the Developer Studio:

import com.sapportals.wcm.crt.CrtClassLoaderRegistry;

public void init(IServiceContext serviceContext){
mm_serviceContext = serviceContext;
CrtClassLoaderRegistry.addClassLoader(this.getKey(), this.getClass().getClassLoader());
}

Entering the Service in the Deployment Descriptor

Open the deployment descriptor dist\web-inf\portalapp.xml for your KMC component. Add the service you created to the XML file as shown in the example below.
Add a service element that names the portal service and properties as follows:

service name
Name you assigned to the service. A fully qualified portal service name is constructed as <application name>.<portal service name>

class name
Fully qualified name of the class

startup
Set  to true to ensure that the portal runtime starts the service at startup.

Adding a Service to the Deployment Descriptor

<?xml version="1.0" encoding="utf-8"?>
<application name="com.sap.ides.kmc.samples" alias="com.sap.ides.kmc.samples">
<application-config>
<property name="releasable" value="false"/>
<property name="startup" value="true"/>
<property name="ClassLoadingPolicy" value="CoreAccessInAPI,transitive"/>
<property name="DeploymentPolicy" value="5.0"/>
<property name="SharingReference" value="com.sap.portal.runtime.config,
com.sap.portal.runtime.config.component, usermanagement,
 knowledgemanagement,
com.sap.portal.ivs.connectorservice"/>
</application-config>
<components/>
<services>
<service name="RFServiceWrapper">
<service-config>
<property name="className" value="com.sap.ides.kmc.portalservicewrapper.PortalServiceWrapper"/>
<property name="startup" value="true"/>
</service-config>
</service>
</services>
</application>

The portal service interacts with the portal runtime as follows:



Deployment

When you have completed the development of your component, you can deploy it to the remote portal for debugging and testing. To do this, you create and export a portal archive called a PAR file. The PAR file is a zip file that contains all the resources included in the portal project.

To create and deploy the PAR file, you use the PAR Export plugin in the Developer Studio:

  1. Activate the Enterprise Portal toolbar with Window -> Open -> Perspective -> Other -> Enterprise Portal
  2. In the toolbar, select the icon with the quick info text Export Par File. The PAR Export plugin opens.
  3. Select the project that contains the classes you want to deploy.
  4. Specify a name for the PAR file. Select the remote portal where the PAR file must be deployed. If no portal is shown in the list, choose Configure Server Settings… to add a portal connection to the list. Make sure you select the option Deploy PAR file.
  5. When you choose Finish the PAR file is automatically generated and exported to the selected remote portal. After deployment you must restart the SAP J2EE Engine of the portal to activate the new application.